package com.wyl.libbase.base

import com.lcodecore.tkrefreshlayout.RefreshListenerAdapter
import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout
import com.wyl.libbase.extend.logD

abstract class NormalActivity : BaseActivity() {
    override fun setContentView() {
        setContentView(getLayoutId())
    }

    protected val loadListener by lazy {
        object : RefreshListenerAdapter() {
            override fun onRefresh(refreshLayout: TwinklingRefreshLayout) {
                refresh()
            }

            override fun onLoadMore(refreshLayout: TwinklingRefreshLayout) {
                loadMore()
            }

            override fun onRefreshCanceled() {
                logD("onRefreshCanceled")
            }

            override fun onFinishRefresh() {
                logD("onFinishRefresh")
            }

            override fun onFinishLoadMore() {
                logD("onFinishLoadMore")
            }

        }
    }

    protected open fun refresh() {}
    protected open fun loadMore() {}
}